package cn.iocoder.yudao.module.picturebook.dal.mysql.membership;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.picturebook.dal.dataobject.membership.MembershipDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.picturebook.controller.admin.membership.vo.*;

/**
 * 会员信息 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface MembershipMapper extends BaseMapperX<MembershipDO> {

    default PageResult<MembershipDO> selectPage(MembershipPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MembershipDO>()
                .eqIfPresent(MembershipDO::getUserId, reqVO.getUserId())
                .eqIfPresent(MembershipDO::getMemberType, reqVO.getMemberType())
                .betweenIfPresent(MembershipDO::getStartTime, reqVO.getStartTime())
                .betweenIfPresent(MembershipDO::getEndTime, reqVO.getEndTime())
                .eqIfPresent(MembershipDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(MembershipDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(MembershipDO::getId));
    }

}